<!DOCTYPE html>
<html>
<head>
    <title>入库记录</title>
    #parse("sys/header.html")
    <style>
        .sugon_upload_btn {
            display: -webkit-inline-box;
            display: inline-block;
        }
        ::-webkit-scrollbar{
            width: 10px;
            height: 10px;
        }
        ::-webkit-scrollbar-thumb{
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #a8a5a5;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div id="reviewLayer" style="display: none;">
        <form class="form-horizontal" style="width: 350px;">
            <div class="form-group">
                <div class="form-group">
                    <div class="col-sm-2 control-label">系统编码</div>
                    <span class="label label-success" style="vertical-align: bottom;">{{sparePartIn.partCode}}</span>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">名称</div>
                    <span class="label label-success" style="vertical-align: bottom;">{{sparePartIn.name}}</span>
                </div>
            </div>
        </form>
    </div>
	<div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <i-select v-model="q.useUnit" placeholder="请选择使用单位">
                        <i-option v-for="useUnit in useUnitList" :value="useUnit.deptId" :key="useUnit.deptId">{{useUnit.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.partName" @on-enter="query" placeholder="备件名称"></i-input>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.erpCode" @on-enter="query" placeholder="ERP编码"></i-input>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.spec" @on-enter="query" placeholder="备件规格"></i-input>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.producor" @on-enter="query" placeholder="供应厂商"></i-input>
                </i-col>
                <i-col span="3">
                    <Date-Picker type="daterange" v-model="dataTime" split-panels placeholder="查询开始时间" style="width: 170px" @on-change="dataChange"></Date-Picker>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.resources" placeholder="请输入来源">
                        <i-option v-for="source in sourceList" :value="source.value" :key="source.value">{{source.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("sparepartin:import"))
                <Upload ref="uploadFile"
                        action="../sparepartin/import"
                        :format ="['xlsx','xls']"
                        :before-upload="handleBeforeUpload"
                        :on-success="handleSuccess" :on-error="handleError"
                        :on-format-error="handleFormatError" class="sugon_upload_btn">
                    <i-button type="error"><i class="fa fa-hand-o-down"></i>&nbsp;导入</i-button>
                </Upload>
                #end
                #if($shiro.hasPermission("sparepartin:export"))
                <i-button type="success" @click="exportData"><i class="fa fa-hand-o-up"></i>&nbsp;导出</i-button>
                #end
                #if($shiro.hasPermission("sparepartin:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("sparepartin:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
	   <Row style="padding: 2px;">
           <table id="jqGrid"></table>
       </Row>
    </div>
    <div id="erpRecord" style="display: none;">
       <Row>
           <i-form ref="erpCodeRef" :model="associateRecord"  :label-width="120">
               <i-col span="22" style="margin-top: 10px;">
                   <Form-item label="已关联ERP编码" prop="erpRecord">
                       <i-input v-model="associateRecord.erpRecord" placeholder="ERP编码" @on-click="recordAreAssociated" readonly icon="md-arrow-dropdown-circle"></i-input>
                   </Form-item>
               </i-col>
           </i-form>
       </Row>
    </div>
    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
		<i-form ref="formValidate" :model="sparePartIn" :rules="ruleValidate" :label-width="80">
            <Row>
                <i-col span="11" >
                    <Form-item label="备件编码" prop="partCode">
                        <i-input v-model="sparePartIn.partCode" placeholder="系统编码" @on-click="getSparePart" readonly icon="md-arrow-dropdown-circle"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2">
                    <Form-item label="备件名称" prop="name">
                        <i-input v-model="sparePartIn.name" placeholder="名称" disabled icon="md-arrow-dropdown-circle" @on-click="getSparePart" ></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="规格" prop="spec">
                        <i-input v-model="sparePartIn.spec" placeholder="规格" disabled></i-input>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2">
                    <Form-item label="计量单位" prop="unit">
                        <i-input v-model="sparePartIn.unit" placeholder="计量单位" disabled></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="来源" prop="resources">
                        <i-select v-model="sparePartIn.resources" placeholder="来源">
                            <i-option v-for="source in sourceList" :value="source.value" :key="source.value">{{source.name}}
                            </i-option>
                        </i-select>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2">
                    <Form-item label="供应商" prop="supplierName" >
                        <i-input v-model="sparePartIn.supplierName" placeholder="供应商" ></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row v-show="sparePartIn.resources == 4">
                <i-col span="11">
                    <Form-item label="关联计划">
                        <i-input v-model="planItemDesc" placeholder="备件需求项唯一码" @on-click="relateNeedsPlanDetail" readonly icon="md-arrow-dropdown-circle"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="11" offset="2">
                    <Form-item label="单价">
                        <i-input v-model="partPrice" placeholder="单价" disabled></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="入库仓库" prop="inStoreId">
                        <i-input v-model="storeName" placeholder="入库仓库" @on-click="getStoreHouse" readonly icon="md-arrow-dropdown-circle"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="11" v-show="flag == 0" offset="2">
                    <Form-item label="货位" prop="cargoLocation" >
                        <i-select v-model="sparePartIn.cargoLocation" style="width: 80%" >
                            <i-option v-for="obj in optionList" :value="obj.id" :key="obj.id">{{obj.postion}} 库存：{{obj.storeNum}}
                            </i-option>
                        </i-select>
                        <i-button type="info" @click="showLoc(0)" icon="md-arrow-round-forward">&nbsp;其它</i-button>
                    </Form-item>
                </i-col>
                <i-col span="11" v-show="flag == 1" offset="2">
                    <Form-item label="新货位" prop="cargoLocationName" >
<!--                        <i-input v-model="sparePartIn.cargoLocationName"  style="width: 80%"></i-input>-->
                        <span>
                            <span>
                                 <i-select v-model="newOldName" style="width: 25%" placeholder="请选择新老车间" clearable="true">
                                    <i-option v-for="obj in newOldWorkShop"  :value="obj.id" :key="obj.id">{{obj.name}}</i-option>
                                </i-select>
                            </span>
                            <span style="width: 2%">
                                 —
                            </span>
                            <span v-show="sparePartIn.resources=='4'">
                                  <i-input v-model="workShopName" disabled="true"  style="width: 20%"></i-input>
                            </span>
                            <span v-show="sparePartIn.resources !='4'">
                                  <i-input v-model="workShopName"  @on-blur="inputBlur" placeholder="请输入车间代码"  style="width: 20%"></i-input>
                            </span>
                             <span style="width: 2%">
                                —
                            </span>
                            <span style="width: 15%">
                                  <i-input v-model="workShopPosition" clearable="true" placeholder="请输入库位 例:1-3-5" plea  style="width: 25%"></i-input>
                            </span>
                        </span>
                        <i-button type="info" @click="showLoc(1)" icon="md-arrow-round-forward">&nbsp;选择</i-button>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="在途数">
                        <i-input v-model="transitNum" placeholder="入库数不得大于在途数" disabled></i-input>
                    </Form-item>
                </i-col>
               <i-col span="11"  offset="2">
                   <Form-item label="入库数量" prop="inNum">
                       <i-input v-model="sparePartIn.inNum" placeholder="入库数量" type="number" min="0" step="1" pattern="\d*"></i-input>
                   </Form-item>
               </i-col>
            </Row>
            <Row>
                <i-col span="11" >
                    <Form-item label="入库人员" prop="stockKeeper" >
                        <i-input v-model="sparePartIn.stockKeeper" placeholder="入库人员" ></i-input>
                    </Form-item>
                </i-col>
               <i-col span="11" offset="2">
                   <Form-item label="备注" prop="remark">
                       <i-input type="textarea" v-model="sparePartIn.remark" placeholder="备注" :rows="1"></i-input>
                   </Form-item>
               </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')" :disabled="isDisabled">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">返回</i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
	</Card>
</div>

<script src="${rc.contextPath}/js/spare/sparepartin.js?_${date.systemTime}"></script>
</body>
</html>
